<?php 
include('header.php');
include('menu.php');
include('config.php');
include_once('connection/connection.php');
function getName($colName,$id)
{
	$sqlgetName="select distinct ".$colName."_name from tbl_lookup_location where ".$colName."_id=".$id;
	$querygetName=mysql_query($sqlgetName);
	$rowgetName=mysql_fetch_row($querygetName);
	return $rowgetName[0];
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/style_question.css" type="text/css" rel="stylesheet" />
<script language="javascript" type="text/javascript" src="js/validate.js"></script>
<script language="javascript" type="text/javascript">
function validate()
{
	valid = true;
	if (document.view_main_q1.district.selectedIndex == 0)
    {
        alert ( "Please select District Name" );
        valid = false;
    }
	if (document.view_main_q1.form_id.selectedIndex == 0)
    {
        alert ( "Please select Form Id" );
        valid = false;
    }
	return valid;
}	
</script>
<title>GIS</title>
</head>
<body>
<div align="center">
<form action="" method="post" enctype="multipart/form-data" onSubmit="return validate()" name="view_main_q1">
	<table border="0" width="941" id="table1" cellspacing="0" cellpadding="0">
	<tr bgcolor="FF9966">
		<td height="29" align="left" valign="top" background="images/title.gif" colspan="4">&nbsp;</td>
	</tr>
	<tr>
	<td bgcolor="#E5E5E5" align="center" colspan="4">
	<span lang="en-us">&nbsp;</span><span lang="en-us" style="font-size: 8.5pt"><font face="Verdana" color="#006699"><b><?php echo $type_scheme;?> GIS Report</b></font></span></td>
</tr>
<tr><td bgcolor="#E5E5E5" align="left" colspan="4">&nbsp;</td>
</tr>
<tr><td align="left" colspan="4">&nbsp;</td>
</tr>
		
		<tr>
			<td colspan="4">
			
<table width="942" bgcolor="#FFFFFF" style="border:1px solid #999999">
  <tr bgcolor="#E5E5E5">
    <td width="42" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Sr.No.</font></td>
    <td width="118" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Block Name </font></td>
    <td width="85" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Block Id </font></td>
    <td width="163" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Village Name </font></td>
    <td width="102" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Village Id </font></td>
    <td width="102" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;CVC</font></td>
    <td width="83" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Scheme</font></td>
    <td width="98" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;No of habitation</font></td>
    <td width="98" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Population</font></td>
    <td width="131" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;No of tanker supply</font></td>
  </tr>
 <?php
$result=mysql_query("SELECT block_id,village_id,cvc,type_scheme,count(habitation_code) as no_of_habit,present_population as population,sum(total_tanker_no) as no_of_tanker_supply FROM tbl_dtls_q1_main main,tbl_dtls_q1_tanker tanker where main.id=tanker.loc_id and main.type_scheme!='RWSS' and district_id=418 group by village_id order by type_scheme");

/*$result=mysql_query("SELECT block_id,village_id,census_vil_code,count(habitation_code) as no_of_habit,present_population as population,sum(total_tanker_no) as no_of_tanker_supply FROM tbl_dtls_q2_main main,tbl_dtls_q2_tanker tanker where main.id=tanker.q2_id and district_id=418 group by village_id");*/
     $i=1;
    while($fetchedRow=mysql_fetch_array($result))
	  {
    $block_id=$fetchedRow['block_id'];
	$village_id=$fetchedRow['village_id'];
	       
 ?>
  <tr>
    <td style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo $i;?></font></td>
    <td style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo getName('block',$block_id);?></font></td>
    <td style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo $block_id;?></font></td>
    <td style="border:1px solid #999999">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo getName('village',$village_id);?></font></td>
    <td style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo $village_id;?></font></td>
    <td style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo $fetchedRow['cvc'];?></font></td>
    <td style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo $fetchedRow['type_scheme'];?></font></td>
    <td style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo $fetchedRow['no_of_habit'];?></font></td>
    <td style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo $fetchedRow['population'];?></font></td>
    <td style="border:1px solid #999999" align="center"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo $fetchedRow['no_of_tanker_supply'];?></font></td>
  </tr>
  <?php
  $i++;
  }
  ?>
</table>			</td>
		</tr>
		<tr>
			<td colspan="4">&nbsp;</td>
		</tr>
	</table>
</form>
</div>
</body>
</html>
